﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

//HCMGPH 1
//VSTIPHCM 1
//VTLHCM
//HE1HCM 1
//FPTHCM
//SPTHCM
//HCM 1
//VTCHCM
//BNVHCM 1
//QDIHCM 1


namespace VNPT.Data
{
    public class DS64TinhThanh
    {
        public string MaMang_Group
        {
            get
            {
                if (string.IsNullOrWhiteSpace(MaMang)) return "--";
                if (MaMang.Length == 3)
                {
                    return MaMang;
                }
                else
                {
                    if (MaMang.Trim() == "HE1HCM" || MaMang.Trim() == "HE1HNI" || MaMang.Trim() == "HE1DNG")
                    {
                        return "HE1HCM";
                    }

                    if (MaMang.EndsWith("GPH"))
                    {
                        return MaMang;
                    }

                    if (MaMang.StartsWith("BNV") || MaMang.StartsWith("QDI") || MaMang.StartsWith("HE1"))
                    {
                        return MaMang.Substring(3);
                    }
                    if (MaMang.StartsWith("VSTIP"))
                    {
                        return MaMang.Substring(5);
                    }
                    return MaMang;
                }

            }
        }
        public int Phut { get; set; }// Dùng để tính toán khi lấy dữ liệu về, không có tác dụng trong tính toán đối soát
        public string MaMang { get; set; }
        public string TenTinh { get; set; }

        public int Di { get; set; }
        public int Den { get; set; }
        public int Di_GPH { get; set; }
        public int Den_GPH { get; set; }

        public int Di_DLK { get; set; }
        public int Den_DLK { get; set; }
        public int Di_GPH_DLK { get; set; }
        public int Den_GPH_DLK { get; set; }


        public double TiLe_Di
        {
            get
            {
                if (this.Di_DLK == 0 && this.Di == 0)
                {
                    return 0;
                }
                return (this.Di_DLK > this.Di ?
                      ((double)(this.Di_DLK - this.Di) * 100F / (double)this.Di_DLK)
                    : ((double)(this.Di - this.Di_DLK) * 100F / (double)this.Di))
                    * (this.Di_DLK >= this.Di ? 1 : -1);
            }
        }
        public double TiLe_Den
        {
            get
            {
                if (this.Den_DLK == 0 && this.Den == 0)
                {
                    return 0;
                }
                return (this.Den_DLK > this.Den ?
                      ((double)(this.Den_DLK - this.Den) * 100F / (double)this.Den_DLK)
                    : ((double)(this.Den - this.Den_DLK) * 100F / (double)this.Den))
                    * (this.Den_DLK >= this.Den ? 1 : -1);
            }
        }
        public double TiLe_Di_GPH
        {
            get
            {
                if (this.Di_GPH_DLK == 0 && this.Di_GPH == 0)
                {
                    return 0;
                }
                return (this.Di_GPH_DLK > this.Di_GPH ?
                      ((double)(this.Di_GPH_DLK - this.Di_GPH) * 100F / (double)this.Di_GPH_DLK)
                    : ((double)(this.Di_GPH - this.Di_GPH_DLK) * 100F / (double)this.Di_GPH))
                    * (this.Di_GPH_DLK >= this.Di_GPH ? 1 : -1);
            }
        }
        public double TiLe_Den_GPH
        {
            get
            {
                if (this.Den_GPH_DLK == 0 && this.Den_GPH == 0)
                {
                    return 0;
                }
                return (this.Den_GPH_DLK > this.Den_GPH ?
                      ((double)(this.Den_GPH_DLK - this.Den_GPH) * 100F / (double)this.Den_GPH_DLK)
                    : ((double)(this.Den_GPH - this.Den_GPH_DLK) * 100F / (double)this.Den_GPH))
                    * (this.Den_GPH_DLK >= this.Den_GPH ? 1 : -1);
            }
        }
    }
}
